import request from '@/utils/request'
import qs from 'qs'

interface User {
  phone: string;
  password: string;
}

export const login = (data: User) => {
  return request({
    method: 'POST',
    url: '/front/user/login',
    // headers: {
    //   'content-type': 'application/x-www-form-urlencoded'
    // },
    // 如果data 是 普通对象 ，则 content-type : application/json
    // data 是 key=1212&key1=1212，则 content-type : application/x-www-form-urlencoded
    // 如果data 是 FormData对象，则 content-type : multipart/form-data
    data: qs.stringify(data)
  })
}

export const getUserInfo = () => {
  return request({
    method: 'POST',
    url: '/front/user/getInfo'
  })
}

export const getUserPages = (data: any) => {
  return request({
    method: 'POST',
    url: '/boss/user/getUserPages',
    data
  })
}

export const forbidUser = (data: {userId: string}) => {
  return request({
    method: 'POST',
    url: '/boss/user/forbidUser',
    data
  })
}
